<?php
namespace App\Http\Validator;

use Swoft\Validator\Annotation\Mapping\IsString;
use Swoft\Validator\Annotation\Mapping\NotEmpty;
use Swoft\Validator\Annotation\Mapping\Pattern;
use Swoft\Validator\Annotation\Mapping\Validator;
use Swoft\Validator\Contract\ValidatorInterface;

/**
 * 验证用户传递的 service 信息参数
 * Class ClientValidator
 * @package App\Http\Validator
 * @Validator(name="ServiceValidator")
 */
class ServiceValidator
{

    /**
     * 服务信息
     * @var string
     * @NotEmpty(message="service 不存在")
     * @IsString(message="service 格式错误")
     * @Pattern(regex="/^[A-Z_a-z]+\.[A-Z_a-z]+\.[A-Z_a-z]+\.[A-Z_a-z]+$/", message="无效路由")
     */
    protected $service;

    /**
     * @return string
     */
    public function getService(): string
    {
        return $this->service;
    }

    /**
     * @param string $service
     */
    public function setService(string $service): void
    {
        $this->service = $service;
    }

}
